﻿@using Webdiyer.WebControls.Mvc;
@model Webdiyer.WebControls.Mvc.PagedList<BaseData.Model.Product>
@{
    var idx = 0;
}
<table class="table table-hover">
    <thead>
        <tr>
            <th>
                序号
            </th>
            <th>
                商品条码
            </th>
            <th>
                商品名称
            </th>
            <th>
                商品类型
            </th>
            <th>
                商品单价(元)
            </th>
            <th>
                操作
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            idx++;

            <tr>
                <td>
                    @idx
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ProductCode)
                </td>
                <td>
                    @if (!string.IsNullOrEmpty(item.ImgUrl))
                    {
                        <img src='/UploadFiles/@item.ImgUrl' width="40px" height="40px" />
                        @Html.DisplayFor(modelItem => item.ProdcutName)
                    }
                    else
                    {
                        <img src='~/UploadFiles/nopic.png' width="40px" height="40px" />
                        @Html.DisplayFor(modelItem => item.ProdcutName)
                    }
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ProductType.ProductTypeName)
                </td>
                <td>
                    ￥@Html.DisplayFor(modelItem => item.DynamicPrice)
                </td>
                <td>

                    <a title="编辑" data-placement="bottom" data-toggle="tooltip" href="javascript:Edit('@item.ProductCode');"><span class=" glyphicon glyphicon-edit"></span></a>
                    &nbsp;&nbsp;
                    <a title="删除" data-placement="bottom" data-toggle="tooltip" href="javascript:Delete('@item.ProductCode')"><span class="glyphicon glyphicon-trash"></span></a>
                    &nbsp;&nbsp;
                    <a title="上传图片" data-placement="bottom" data-toggle="tooltip" href="javascript:UploadImg('@item.ProductCode')"><span class="glyphicon glyphicon-cloud-upload"></span></a>
                </td>
            </tr>
        }
    </tbody>
</table>


<hr />
<div style="padding-top:5px; width:100%">
    <div style="float:left">共 @Model.TotalPageCount 页 @Model.TotalItemCount 条记录，当前为第 @Model.CurrentPageIndex 页</div>
    @Ajax.Pager(Model, new PagerOptions {CssClass = "pager", PageIndexParameterName = "id", ShowPageIndexBox = false, PageIndexBoxType = PageIndexBoxType.DropDownList, ShowGoButton = false }, new MvcAjaxOptions { UpdateTargetId = "products", DataFormId = "searchForm" }, new { style = "float:right" })
   


</div>